char arr[]=new char[100]; int n=dr.read(arr);
char arr[]=new char[100]; int n=dr.read(arr,25,50);Note:above read methods returns -1 at end of stream
File fa=new File("c:/temp/demo.txt"); FileReader dr=new FileReader(fa);
import java.io.*; class demo { public static void main(String[ ] args) throws Exception { FileReader fd=new FileReader("c:\\temp\\info.txt"); int ch; while((ch=fd.read())!=-1) System.out.print((char)ch); fd.close(); } }
Welcome to CCIT Amravati
char arr[]={'A','m','r','a','v','a','t','i'}; wr.write(arr);
char arr[]={'A','m','r','a','v','a','t','i'}; wr.write(arr,0,4);
String data="Amravati"; wr.write(data,0,4);
File fa=new File("c:/temp/info.txt"); FileWriter fw=new FileWriter(fa);
import java.io.*; class demo { public static void main(String[ ] args) throws Exception { FileWriter fw=new FileWriter("c:\\temp\\myinfo.txt"); fw.write("P.Choudhari"); fw.write("\nCCIT\nRajapeth\nAmravati"); fw.close(); } }
import java.io.*; class demo { public static void main(String[ ] args) throws Exception { FileWriter fw=new FileWriter("c:\\temp\\myinfo.txt"); fw.write("P.Choudhari"); fw.write("\nCCIT\nRajapeth\nAmravati"); fw.close(); } }
file copied...